package cn.heckman.springbatch.batchTask;

import cn.heckman.springbatch.batchTaskCommon.SpringBatchCommonConfig;
import cn.heckman.springbatch.entity.BlacklistDetectionVo;
import org.springframework.batch.core.configuration.annotation.StepScope;
import org.springframework.batch.item.ItemProcessor;
import org.springframework.stereotype.Component;

@Component
@StepScope
public class LjBatchItemProcessor implements ItemProcessor<BlacklistDetectionVo, BlacklistDetectionVo> {

    @Override
    public BlacklistDetectionVo process(BlacklistDetectionVo blacklistDetectionVo) throws Exception {
        if ("1".equals(blacklistDetectionVo.getFlag())) {
            SpringBatchCommonConfig.blackNum.getAndIncrement();
        } else if ("0".equals(blacklistDetectionVo.getFlag())) {
            SpringBatchCommonConfig.whiteNum.getAndIncrement();
        } else {
            SpringBatchCommonConfig.otherNum.getAndIncrement();
        }
        return blacklistDetectionVo;
    }
}
